﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace HHControls.CreditEducation
{
    public class HHArrowLabel : Label
    {
        public Color ParentColor { get; set; }

        public HHArrowLabel()
        {
            Initialize();

        }

        private void Initialize()
        {
            ParentColor = Color.White;
            ForeColor = Color.White;
            BackColor = Color.LightSteelBlue;
            Font = new Font("Times New Roman", 16, FontStyle.Bold, GraphicsUnit.Point);
            AutoSize = false;
            Height = 30;
            Width = 200;
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            e.Graphics.Clear(BackColor);

            var layoutRectangle = new Rectangle(Height, 0, Width - 2 * Height, Height);
            var stringFormat = new StringFormat
            {
                Alignment = StringAlignment.Near,
                LineAlignment = StringAlignment.Center
            };
            e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), layoutRectangle, stringFormat);

            //e.Graphics.FillEllipse(new SolidBrush(ParentColor), -2 * Height / 3, 0, Height, Height);
            //e.Graphics.FillRectangle(new SolidBrush(ParentColor), Width - Height / 3, 0, Height / 2, Height);
            //e.Graphics.FillEllipse(new SolidBrush(BackColor), Width - Height, 0, Height, Height);

            e.Graphics.FillPolygon(new SolidBrush(ParentColor), new[] { new Point(0, 0), new Point(Height / 2, Height / 2), new Point(0, Height) });
            e.Graphics.FillRectangle(new SolidBrush(ParentColor), Width - Height / 2, 0, Height / 2, Height);
            e.Graphics.FillPolygon(new SolidBrush(BackColor), new[] { new Point(Width - Height / 2, 0), new Point(Width, Height / 2), new Point(Width - Height / 2, Height) });
        }


    }
}
